home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / vgakit41 / xpoint.asm < prev    next >
Assembly Source File  |  1991-10-02  |  1KB  |  86 lines

  1.  
  2.     include    model.h
  3.  
  4. ;
  5. ;    VGAKIT Version 4.1
  6. ;
  7. ;    Copyright 1988,89,90,91 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    XPOINT.ASM
  11. ;
  12. ;
  13. .data
  14.  
  15.     extrn    curbk:word
  16.     extrn    maxx:word,maxy:word,xwidth:word
  17.  
  18. .code
  19.  
  20.     extrn    newbank:proc
  21.  
  22.     public    xpoint
  23.     public    xpoint13x
  24.  
  25. xpoint    proc    xpos:word,ypos:word,color:word
  26.     mov    bx,[xpos]
  27.     mov    ax,[ypos]
  28.     mov    dx,[maxx]
  29.     cmp    bx,0
  30.     jl    nope1
  31.     cmp    bx,dx
  32.     jge    nope1
  33.     cmp    ax,0
  34.     jl    nope1
  35.     cmp    ax,[maxy]
  36.     jge    nope1
  37.     mul    [xwidth]            ;640 bytes wide in most cases
  38.     add    bx,ax
  39.     adc    dx,0
  40.     mov    ax,dx
  41.     cmp    ax,[curbk]
  42.     jz    nonew
  43.     call    newbank            ;switch banks if a new bank entered
  44. nonew:    mov    ax,0a000h        ;setup screen segment A000
  45.     mov    es,ax
  46.     mov    al,byte ptr [color]    ;get color of pixel to plot
  47.     xor    es:[bx],al
  48. nope1:    ret
  49. xpoint    endp
  50.  
  51. xpoint13x proc    xpos:word,ypos:word,color:word
  52.     mov    bx,[xpos]
  53.     mov    ax,[ypos]
  54.     mov    dx,[maxx]
  55.     cmp    bx,0
  56.     jl    nope2
  57.     cmp    bx,dx
  58.     jge    nope2
  59.     cmp    ax,0
  60.     jl    nope2
  61.     cmp    ax,[maxy]
  62.     jge    nope2
  63.     mul    [xwidth]            ;80 dots wide (for 360x480 mode)
  64.     mov    cx,bx
  65.     shr    bx,1
  66.     shr    bx,1
  67.     add    bx,ax
  68.     mov    ax,102h    
  69.     and    cl,3
  70.     shl    ah,cl            ;create bit plane mask
  71.     mov    dx,3c4h
  72.     out    dx,ax            ;set EGA bit plane mask register
  73.     mov    dl,0ceh
  74.     mov    al,4
  75.     mov    ah,cl
  76.     out    dx,ax            ;set EGA bit plane read regsiter
  77.     mov    ax,0a000h        ;setup screen segment A000
  78.     mov    es,ax
  79.     mov    al,byte ptr [color]    ;get color of pixel to plot
  80.     xor    es:[bx],al
  81. nope2:    ret
  82. xpoint13x endp
  83.  
  84.     end
  85.  
  86.